package com.meizi.daily.status;

import com.meizi.core.tool.status.IStatus;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author meizi
 * @email enjoymeizi@gmail.com
 * @date 2020/11/27 14:25
 */
public enum WalletTypeEnum implements IStatus {
    PRE(0, "预支"),
    NOW(1, "现结"),
    AFTER(2, "已结"),
    /**
     * 对预支金额的还款
     */
    REPAYMENT(3,"还款")

            ;

    private Integer code;
    private String message;

    WalletTypeEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    @Override
    public int getCode() {
        return this.code;
    }

    @Override
    public String getMsg() {
        return this.message;
    }

    public static String getMessage(Integer code) {
        for (WalletTypeEnum status : WalletTypeEnum.values()) {
            if (status.code.equals(code)) {
                return status.getMsg();
            }
        }
        return null;
    }

    public static List<Map<String, Object>> mapper() {
        List<Map<String, Object>> list = new ArrayList<>(SatisfactionEnum.values().length);
        for (WalletTypeEnum status : WalletTypeEnum.values()) {
            Map<String, Object> map = new HashMap<>(2);
            map.put("code", status.getCode());
            map.put("message", status.getMsg());
            list.add(map);
        }
        return list;
    }
}
